<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Repositories\CategoryRepo;

class CategoryController extends ApiBaseController
{
   public function simple(Request $request)
   {
       //获取分类
      $categoryRepo = new CategoryRepo();
      $data = $categoryRepo->getSimpleCategory();
      return $this->sucRes(200,$data);
   }
   public function lists(Request $request)
    {
       //获取分类
		$categoryRepo = new CategoryRepo();
		$data = $categoryRepo->getCategoryList(0);
		return $this->sucRes(200,$data);

    }
    public function productlists(Request $request)
    {
       $input = $request->only(['cate_id']);
       $categoryRepo = new CategoryRepo();
       $data['category'] = $categoryRepo->getInfo($input['cate_id']);
       $data['products'] = $categoryRepo->getProducts($input);
       return $this->sucRes(200,$data);
    }
}
